import { API_LIST } from '../../../Api/Api'
import { commonTableList } from '../Common/common'
import { CommonButton } from '../Common/options'

export const WeeklyReportStatistics = async ({ url, OptionsEvent, ClientData, Permission, actionRef }) => {
    let data = {
        pageSize: 10,
        params: { pageIndex: 1 },
        get: API_LIST()[`get${url}`],
        added: `pos${url}`,
        modify: `put${url}`,
        delete: `del${url}`,
        hideInSearch: true,
        options: [
            // <AddDataButton OptionsEvent={OptionsEvent} type="primary" icon="add" title="新增" />
        ],
        columns: [
            { ...commonTableList.SearchSort, selectType: 'WeeklyReports' },
            // {
            //     ...commonTableList.parentUuid,
            //     fieldProps: {
            //         fieldNames: { label: 'tableName', value: 'uuid' },
            //         options: parentUuid,
            //     },
            // },
            commonTableList.uuid,
            {
                dataIndex: 'date',
                title: '日期',
                valueType: 'render',
                width: 200,
                hideInAdded: true,
                render: (_, { monday, friday }) => (
                    <div>
                        {' '}
                        {monday.split(' ')[0]} 至 {friday.split(' ')[0]}
                    </div>
                ),
            },
            {
                dataIndex: '部门总数',
                title: '部门总数',
                valueType: 'input',
                width: 80,
                hideInAdded: true,
            },
            {
                dataIndex: '已提交数量',
                title: '已提交数量',
                valueType: 'input',
                width: 80,
                hideInAdded: true,
            },
            {
                dataIndex: '未提交数量',
                title: '未提交数量',
                valueType: 'input',
                width: 80,
                hideInAdded: true,
            },
            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 160,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    return [
                        <CommonButton
                            key="one"
                            title="已提交列表"
                            OptionsEvent={OptionsEvent}
                            modal="CustomList"
                            other={{ page: 'one', header: {}, record }}
                            data={{ type: 'ThrRouter', width: 600 }}
                        />,
                        <CommonButton
                            key="two"
                            title="未提交列表"
                            OptionsEvent={OptionsEvent}
                            modal="CustomList"
                            other={{ page: 'two', header: {}, record }}
                            data={{ type: 'ThrRouter', width: 600 }}
                        />,
                    ]
                },
            },
        ],
    }

    return data
}
